//
//  FCFirstVC.m
//  FundChain
//
//  Created by 肖浩然的mac on 2018/2/6.
//  Copyright © 2018年 RUIXIN. All rights reserved.
//

#import "FCFirstVC.h"
#import "FCRegisteVC.h"
#import "FCLoginVC.h"
#import <LocalAuthentication/LocalAuthentication.h>
@interface FCFirstVC ()

@end

@implementation FCFirstVC


- (void)viewDidLoad {
    [super viewDidLoad];
   [FCLocalUserHelper saveIsMainVC:@"0"];
    //设置UI
    [self setupUI];
    
}
#pragma mark-设置UI
-(void)setupUI{
    
  //背景图片
    UIImageView *bgImageView = [UIImageView new];
    [self.view addSubview:bgImageView];
    [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(0);
    }];
    bgImageView.image = [UIImage imageNamed:@"bg_login"];
    //Icon图标
    UIImageView *iconImageView = [UIImageView new];
    [bgImageView addSubview:iconImageView];
    [iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        if (@available(iOS 11.0, *)) {
            if (iPhoneX) {
                make.centerX.mas_equalTo(0);
                make.top.mas_equalTo((240)*KScreenHeightScale1334);
                
            }else{
              make.centerX.mas_equalTo(0);
                make.top.mas_equalTo(240*KScreenHeightScale1334);
                
            }
        }else{
            make.centerX.mas_equalTo(0);
            make.top.mas_equalTo(240*KScreenHeightScale1334);
            
        }
    }];
    iconImageView.image = [UIImage imageNamed:@"logo_login"];
    
   
   
    //登陆按钮
    UIButton *loginBtn = [UIButton new];
    [self.view addSubview:loginBtn];
    [loginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(-100*KScreenHeightScale1334);
        make.centerX.mas_equalTo(0);
        make.left.mas_equalTo(70*KScreenWidthScale750);
        make.right.mas_equalTo(-70*KScreenWidthScale750);
        make.height.mas_equalTo(110*KScreenHeightScale1334);
    }];
    loginBtn.layer.cornerRadius = 5.0;
    loginBtn.layer.masksToBounds = YES;
    loginBtn.layer.borderWidth = 1.0;
    loginBtn.titleLabel.font = KOverstrikingfont(36);
    loginBtn.layer.borderColor = kRedOrangeColor.CGColor;
    [loginBtn setTitle:Localized(@"登录") forState:(UIControlStateNormal)];
    [loginBtn setTitleColor:kRedOrangeColor forState:UIControlStateNormal];
    
    
    //注册按钮
    UIButton *registerBtn = [UIButton new];
    [self.view addSubview:registerBtn];
    [registerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(loginBtn.mas_top).offset(-60*KScreenHeightScale1334);
        make.centerX.mas_equalTo(0);
        make.left.mas_equalTo(70*KScreenWidthScale750);
        make.right.mas_equalTo(-70*KScreenWidthScale750);
        make.height.mas_equalTo(110*KScreenHeightScale1334);
    }];
    registerBtn.layer.cornerRadius = 5.0;
    registerBtn.layer.masksToBounds = YES;
    registerBtn.titleLabel.font = KOverstrikingfont(36);
    [registerBtn setTitle:Localized(@"创建钱包") forState:(UIControlStateNormal)];
    [registerBtn setTitleColor:kWhiteColor forState:UIControlStateNormal];
    [registerBtn setBackgroundColor:kRedOrangeColor];
    //事件
    [loginBtn addTarget:self action:@selector(loginBtnClick:) forControlEvents:(UIControlEventTouchUpInside)];
    [registerBtn addTarget:self action:@selector(registerBtnClick:) forControlEvents:(UIControlEventTouchUpInside)];
   
}


#pragma mark-注册
-(void)registerBtnClick:(UIButton*)sender{
    
    FCRegisteVC *vc = [FCRegisteVC new];
    
    [self.navigationController pushViewController:vc animated:NO];
}

#pragma mark-登陆
-(void)loginBtnClick:(UIButton*)sender{
    
    
    FCLoginVC *vc = [FCLoginVC new];
    
    [self.navigationController pushViewController:vc animated:NO];
    
}
@end
